package edu.ccut.saturn.basecomponent.database.impl.sqlserver.builder;

import java.util.HashMap;
import java.util.Map;

import edu.ccut.saturn.basecomponent.database.IDeleteSQLBuilder;
import edu.ccut.saturn.basecomponent.database.IInsertSQLBuilder;
import edu.ccut.saturn.basecomponent.database.ISelectSQLBuilder;
import edu.ccut.saturn.basecomponent.database.ISaturnSQL;
import edu.ccut.saturn.basecomponent.database.ISaturnSQLBuilder;
import edu.ccut.saturn.basecomponent.database.IUpdateSQLBuilder;

public class SaturnSqlServerSQLBuilder implements ISaturnSQLBuilder {
	private static Map<String, IDeleteSQLBuilder> deleteSQLBuilder = new HashMap<String, IDeleteSQLBuilder>();

	private static Map<String, IUpdateSQLBuilder> updateSQLBuilder = new HashMap<String, IUpdateSQLBuilder>();

	private static Map<String, ISelectSQLBuilder> selectSQLBuilder = new HashMap<String, ISelectSQLBuilder>();

	private static Map<String, IInsertSQLBuilder> insertSQLBuilder = new HashMap<String, IInsertSQLBuilder>();

	public SaturnSqlServerSQLBuilder() {
		
//		insertSQLBuilder.put(ISaturnSQL.INSERT_OPERATION,
//				new SqlServerInsertSQLBuilder());
		
		insertSQLBuilder.put(ISaturnSQL.INSERT_OPERATION,
				new SqlServerInsertLOBSQLBuilder());
		
		insertSQLBuilder.put(ISaturnSQL.INSERT_LOB_OPERATION,
				new SqlServerInsertLOBSQLBuilder());
		
		selectSQLBuilder.put(ISaturnSQL.SELECT_OPERATION,
				new SqlServerSelectSQLBuilder());
		
		selectSQLBuilder.put(ISaturnSQL.SELECT_COUNT_OPERATION,
				new SqlServerSelectCountSQLBuilder());
		
		selectSQLBuilder.put(ISaturnSQL.SELECT_LOB_OPERATION,
				new SqlServerSelectSQLBuilder());
		
//		updateSQLBuilder.put(ISaturnSQL.UPDATE_OPERATION,
//				new SqlServerUpdateSQLBuilder());
		
		updateSQLBuilder.put(ISaturnSQL.UPDATE_OPERATION,
				new SqlServerUpdateLOBSQLBuilder());
		
		updateSQLBuilder.put(ISaturnSQL.UPDATE_LOB_OPERATION,
				new SqlServerUpdateLOBSQLBuilder());
		
		deleteSQLBuilder.put(ISaturnSQL.DELETE_OPERATION,
				new SqlServerDeleteSQLBuilder());
	}

	public IDeleteSQLBuilder getDeleteSQLBuilder(String key) {
		return deleteSQLBuilder.get(key);
	}

	public IInsertSQLBuilder getInsertSQLBuilder(String key) {
		return insertSQLBuilder.get(key);
	}

	public ISelectSQLBuilder getSelectSQLBuilder(String key) {
		return selectSQLBuilder.get(key);
	}

	public IUpdateSQLBuilder getUpdateSQLBuilder(String key) {
		return updateSQLBuilder.get(key);
	}
}
